package com.nineclock.document.controller;

import com.nineclock.common.entity.PageResult;
import com.nineclock.common.entity.Result;
import com.nineclock.document.PcDocumentControllerApi;
import com.nineclock.document.dto.DocFileDto;
import com.nineclock.document.service.PcDocumentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class PcDocumentController implements PcDocumentControllerApi {
    @Autowired
    PcDocumentService pcDocumentService;

    @Override
    @GetMapping("/pagingFile")
    public Result<PageResult<DocFileDto>> pagingFile(
            @RequestParam(value = "page", required = false, defaultValue = "1") Integer page,
            @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize,
            @RequestParam(value = "keyword", required = false) String keyword) {
        PageResult<DocFileDto> pageResult = pcDocumentService.pagingFile(page, pageSize, keyword);
        return Result.success(pageResult);
    }
}
